//
//  LGBreathRecordCell.m
//  HeartDisease_YHJK
//
//  Created by 1234 on 2025/8/6.
//

#import "LGBreathRecordCell.h"

@interface LGBreathRecordCell()

/**   */
@property (nonatomic , strong)UIImageView *iconView;
/**   */
@property (nonatomic , strong)UILabel *titleLabel;
/**   */
@property (nonatomic , strong)UIImageView *statusIcon;

@end

@implementation LGBreathRecordCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubView];
    }
    return  self;
}

-(void)setDataDic:(NSDictionary *)dataDic{
    [super setDataDic:dataDic];
    self.titleLabel.text = LGNSString(dataDic[@"title"]);
    NSString *iconName = [NSString stringWithFormat:@"呼吸训练-类型%@",dataDic[@"type"]];
    self.iconView.image = [UIImage imageNamed:iconName];
    NSString *statusIcon = [NSString stringWithFormat:@"呼吸训练-评分%@",dataDic[@"appraise"]];
    self.statusIcon.image = [UIImage imageNamed:statusIcon];
}


#pragma mark
#pragma mark ====> 创建控件
-(void)createSubView{
    [self.contentView addSubview:self.iconView];
    [self.contentView addSubview:self.titleLabel];
    [self.contentView addSubview:self.statusIcon];
    
    [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(viewPix(16));
        make.left.equalTo(self.contentView).offset(viewPix(28));
        make.bottom.equalTo(self.contentView).offset(-viewPix(16));
        make.width.height.equalTo(@(24));
    }];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.iconView.mas_right).offset(viewPix(8));
        make.centerY.equalTo(self.iconView);
    }];
    
    [self.statusIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView).offset(-viewPix(28));
        make.centerY.equalTo(self.iconView);
        make.width.height.equalTo(@(20));
    }];
}
-(UIImageView *)iconView{
    if(!_iconView){
        _iconView = [[UIImageView alloc]init];
    }
    return _iconView;
}

-(UILabel *)titleLabel{
    if(!_titleLabel){
        _titleLabel = [UILabel lableWithText:@"" colorString:@"#282828" textFont:LGFontWeight(16, UIFontWeightSemibold) textAlignment:NSTextAlignmentLeft lines:1];
    }
    return _titleLabel;
}

-(UIImageView *)statusIcon{
    if(!_statusIcon){
        _statusIcon = [[UIImageView alloc]init];
    }
    return _statusIcon;
}

@end
